Ext.define('FMessage', {
   extend: 'Ext.window.Window',
   alias: 'widget.fmessage',
   closable: false,
   closeAction: 'hide',
   title: 'Info',
   msg: 'Message',
   iconCls: 'fmessage-icon',
   img: 'info.png',
   height: 180,
   width: 500,
   padding: 4,
   btnAction: null,
   initComponent: function()
   {
       this.resizable = false;
       
       // Define o tamanho da janela.
       this.height = this.height;
       this.width = this.width;
       this.padding = this.padding;
       
       // Centraliza o título.
       this.titleAlign = 'center';
       
       this.modal = true;
       this.border = 1;
       this.layout = 'vbox';
       this.layoutConfig = {align: 'stretch'};
       this.style = {
           borderColor: '#DDD',
           borderStyle: 'solid',
           fontWeight: 'bold'
       };
       
       this.items = [
           {
               xtype: 'container', width: '100%', layout: 'hbox', flex: 2, items: [
                   {
                       xtype: 'image',
                       width: '20%',
                       height: '100%',
                       padding: '10 10 10 14',
                       src: 'themes/default/images/' + this.img
                   },
                   {
                       xtype: 'label',
                       width: '5%',
                       height: '100%'
                   },
                   {
                       xtype: 'label',
                       width: '75%',
                       height: '100%',
                       padding: '20 10 0 50',
                       cls: 'text-message',
                       html: this.msg
                   }
               ]
           },
           {
               xtype: 'container', width: '100%', layout: {type: 'hbox', pack: 'center'}, flex: 1, items: [
                   {
                       xtype: 'fbuttonok',
                       scope: this,
                       handler: this._onBtnCloseClick
                   }
               ]
           }
       ];
       
       this.callParent();
   },
   _onBtnCloseClick: function()
    {
        if ( this.btnAction )
        {
            this.btnAction();
        }
        Ext.getCmp(this.id).close();        
    }
});

Ext.define('FMessageSuccess', {
   extend: 'FMessage',
   alias: 'widget.fmessagesuccess',
   img: 'success.png'   
});

Ext.define('FMessageError', {
   extend: 'FMessage',
   alias: 'widget.fmessageerror',
   img: 'error.png'
});

Ext.define('FMessageAlert', {
   extend: 'FMessage',
   alias: 'widget.fmessagealert',
   img: 'alert.png'
});